home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
BBS-Archive
/
Comm
/
term-source.lha
/
Extras
/
Source
/
term-Source.lha
/
termDebug.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-04-14
|
3KB
|
129 lines
/*
** termDebug.c
**
** Debugging support code
**
** Copyright © 1990-1995 by Olaf `Olsen' Barthel
** All Rights Reserved
**
** :ts=4
*/
#include "termGlobal.h"
STATIC struct Screen *DebugScreen;
STATIC struct Window *DebugWindow;
STATIC struct RastPort *DebugRPort;
VOID
DebugExit()
{
if(DebugWindow)
{
CloseWindow(DebugWindow);
DebugWindow = NULL;
}
if(DebugScreen)
{
CloseScreen(DebugScreen);
DebugScreen = NULL;
}
}
BOOL
DebugInit()
{
if(DebugScreen)
return(TRUE);
else
{
ULONG DisplayID = DEFAULT_MONITOR_ID | HIRESLACE_KEY;
struct Screen *PubScreen;
if(PubScreen = LockPubScreen(NULL))
{
DisplayID = GetVPModeID(&PubScreen -> ViewPort);
UnlockPubScreen(NULL,PubScreen);
}
if(DebugScreen = OpenScreenTags(NULL,
SA_Depth, 1,
SA_Overscan, OSCAN_TEXT,
SA_DisplayID, DisplayID,
SA_Font, &DefaultFont,
SA_Title, "term Debug Screen",
SA_Behind, TRUE,
TAG_DONE))
{
if(DebugWindow = OpenWindowTags(NULL,
WA_CustomScreen, DebugScreen,
WA_Top, DebugScreen -> BarHeight + 1,
WA_Left, 0,
WA_Width, DebugScreen -> Width,
WA_Height, DebugScreen -> Height - (DebugScreen -> BarHeight + 1),
WA_RMBTrap, TRUE,
WA_Backdrop, TRUE,
WA_Borderless, TRUE,
TAG_DONE))
{
DebugRPort = DebugWindow -> RPort;
return(TRUE);
}
CloseScreen(DebugScreen);
DebugScreen = NULL;
}
return(FALSE);
}
}
VOID
DebugShowScrollInfo(VOID)
{
UBYTE LocalBuffer[256];
WORD i,Left;
for(i = 0 ; i < RasterHeight ; i++)
{
if(i == ScrollLineFirst)
SPrintf(LocalBuffer,"+%3ld %02lx",i,ScrollLines[i] . ColourMask);
else
{
if(i == ScrollLineLast)
SPrintf(LocalBuffer,"-%3ld %02lx",i,ScrollLines[i] . ColourMask);
else
SPrintf(LocalBuffer," %3ld %02lx",i,ScrollLines[i] . ColourMask);
}
if(i == ScrollLineFirst || i == ScrollLineLast)
SetABPenDrMd(DebugRPort,0,1,JAM2);
else
SetABPenDrMd(DebugRPort,1,0,JAM2);
Move(DebugRPort,0,DebugRPort -> TxBaseline + i * DebugRPort -> TxHeight);
Text(DebugRPort,LocalBuffer,strlen(LocalBuffer));
Left = DebugRPort -> cp_x;
SetABPenDrMd(DebugRPort,0,0,JAM1);
RectFill(DebugRPort,Left,i * DebugRPort -> TxHeight,DebugWindow -> Width - 1,(i + 1) * DebugRPort -> TxHeight - 1);
if(ScrollLines[i] . Width)
{
SetAPen(DebugRPort,1);
SetAfPt(DebugRPort,(UWORD *)&Ghosting,1);
RectFill(DebugRPort,Left + ScrollLines[i] . Left * 3,i * DebugRPort -> TxHeight,Left + ScrollLines[i] . Right * 3 - 1,(i + 1) * DebugRPort -> TxHeight - 1);
SetAfPt(DebugRPort,NULL,0);
}
}
}